package 二叉树题目.判断子序列;

public class Solution {
    public static boolean isSubsequence(String S, String T) {
        // write code here
        int lenS = S.length();
        int lenT = T.length();
        int i = 0; // 遍历S
        int j = 0; // 遍历T
        while (i < lenS && j < lenT) {
            if (S.charAt(i) == T.charAt(j)){
                i++;
                j++;
            }else {
                j++;
            }
        }
        return i == lenS;
    }
}
